<%@page import="com.billing.model.entity.Message"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@page isELIgnored="false" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>新增咨询</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link id="bootstrap-style" href="<c:url value="/css/bootstrap.min.css"/>" rel="stylesheet">
	<link href="<c:url value="/css/bootstrap-responsive.min.css"/>" rel="stylesheet">
	<link id="base-style" href="<c:url value="/css/style.css"/>" rel="stylesheet">
	<link id="base-style-responsive" href="<c:url value="/css/style-responsive.css"/>" rel="stylesheet">
	<link href="<c:url value="/css/index.css"/>" rel="stylesheet">
	<link rel="shortcut icon" href="<c:url value="/img/favicon.ico"/>">
	<link href="<c:url value="/css/page.css"/>" rel="stylesheet">
	<link rel="stylesheet" type="text/css" href="<c:url value="/css/jquery.datetimepicker.css"/>"/>
	<link href="<c:url value="/css/navuser.css"/>" rel="stylesheet">
	<link href="<c:url value="/css/but.css"/>" rel="stylesheet">
	<script src="<c:url value="/js/jquery-1.9.1.min.js"/>"></script>
	<script src="<c:url value="/js/jquery-migrate-1.0.0.min.js"/>"></script>
	<script type="text/javascript" src="<c:url value="/js/layer/layer.js"/>"></script>
	<script src="<c:url value="/js/laydate/laydate.js"/>"></script>
	<script src="<c:url value="/js/build/jquery.datetimepicker.full.js"/>"></script>
	<script src="<c:url value="/js/orgin.js"/>"></script>
	<script src="<c:url value="/js/filebut.js"/>"></script>
	
	<script src="../../../../scripts/boot.js" type="text/javascript"></script>
    <script src="http://kindeditor.net/ke4/kindeditor-all-min.js?t=20160331.js" type="text/javascript"></script>
</head>
 <script type="text/javascript">
 function save(){
	 var consultingtitle = $("#consultingtitle").val();//标题
	 var outline = $("#outline").val();//摘要
	 var articletypeid = $("#articletypeid").val();//类型
	 if(consultingtitle == null || consultingtitle == ""){
		 alert("请输入标题！");
		 return;
	 }
	 if(outline == null || outline == ""){
		 alert("请输入摘要！");
		 return;
	 }
	 if(articletypeid == null || articletypeid == ""){
		 alert("请输入类型！");
		 return;
	 }
	 if((editor.html().length-12) <= 0){
		 alert("请输入内容！");
		 return;
	 }
	 beyond();
	 getContent();
	 $("#customerform").submit();
 }
 
 function beyond(){
	 var outline = $("#outline").val();
	 var showText = document.getElementById("outline");
	 if(outline.length > 80){
		 showText.style.color = "red";
		 alert("摘要超出最大输入字数80！！！")
		 return;
	 }else{
	 	showText.style.color = "black";
	 }
 }
 
 $(function(){ 
	 var msg="${msg}";
	 if(msg!=null&&msg!=""){
		 alert(msg);
         closebutton();
         window.parent.location.reload(); //刷新父页面
	 }
 }); 
 
 
 //返回
 function reback(){
     var url='<%=basePath%>message/mainpage';
     parent.$("#mainFrame").attr("src",url);
 }
 
 //取消
 function closebutton() {
		var index = parent.layer.getFrameIndex(window.name);  
	 	parent.layer.close(index);  
}
</script>
<body>
<div id="content" class="span10" style="background-color:#F9F9F9;">
<div style="background-color:#FFF">
<form name="customerform" id="customerform" method="post" enctype="multipart/form-data" action="<%=basePath%>message/conseditadd">
	
	<table>
			<tr>
				<td>标题：<font color="red">*</font></td>
				<td colspan = "3">
						<input style="width: 100%;" type="text" id="consultingtitle" name="consultingtitle" value="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				</td>
			</tr>
			<tr>
				<td>摘要：<font color="red">*</font></td>
				<td colspan = "3">
						<input style="width: 100%;" type="text" onkeyup="beyond();" id="outline" name="outline" value="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				</td>
			</tr>
			<tr>
				<td>作者：</td>
				<td>
						<input type="text" id="writer" name="writer" value="">
				</td>
				<td>内容类型：<font color="red">*</font></td>
				<td>
					<select name="articletypeid" id="articletypeid" class="buildselect">
						<option value="">请选择</option>
						<c:forEach items="${articletypelist }" var="a">
							<option value="${a.id }"  ${a.id==conlist.articletypeid?'selected':''}>${a.name }</option>
						</c:forEach> 
					</select>
				</td>
			</tr>
			<tr>
				<td>来源：</td>
				<td>
						<input type="text" id="belonging" name="belonging" value="">
				</td>
				<td>来源地址：</td>
				<td>
						<input type="text" id="sourceaddress" name="sourceaddress" value="">
				</td>
			</tr>
			<!-- <tr> 
				<td>上传照片：</td>
				<td colspan = "3">
					<div style="width:15%;float:left;">
						<div class="filebut">
							<a class="input-file input-fileup" id="buteducation" href="javascript:;">
					         + 上传照片<input size="100" type="file" name="educationfile" id="educationfile">
							</a>
						</div>
					</div>
					<div><label></label></div>	
					<div class="fileerrorTip_cons"></div>	
					<div class="showFileName_cons" ></div>
				</td>
			</tr> -->	
			<tr>
				<td>内容：<font color="red">*</font></td>
				<td colspan = "3">
					<div class="mini-panel" title="表单" style="width:680px;height:300px;" showCollapseButton="true">
			        
			        <div name="editor" id="editor" rows="10" cols="80" style="height:280px;">
						   <textarea style="height:2px;width:686px " rows="6" id="article" name="article"></textarea>
							<div style="display: none">
								<textarea style="height:2px;width:686px " rows="6" id="harticle" name="harticle"></textarea>
					        </div> 
			        </div>
			        </div>
			        	<button style="background-color: #dadada;color: #666;" type="button" onclick="setDisabled();" id="output1">设置编辑器只读</button>
				        <button style="background-color: #dadada;color: #666;" type="button" onclick="setEnabled();" id="output1">取消编辑器只读</button>
				        <!-- <button style="background-color: #dadada;color: #666;" type="button" onclick="getContent();" id="output1">获取编辑器的值</button> -->
			        <script type="text/javascript">
					    var editor = KindEditor.create('#editor');
					    function setDisabled() {editor.readonly();}
					    function setEnabled() {editor.readonly(false);}
					    function getContent() {
					    		/* alert(editor.html());*/
					    		$("#harticle").val(editor.html())
					    		//alert($("#harticle").val())
					    }
					</script>
				</td>
			</tr>
	</table>
</form>
<div class="row-fluid content-table">
<table class="table  bootstrap-datatable" style=" border:none; border-spacing:0; border-collapse:collapse;margin:0;padding:0;">
	<tbody>
		<tr class="content-search" style="text-align: center;">
			<td colspan="6">
					<div>
						<button style="background-color: #dadada;color: #666;" type="button" onclick="closebutton();" id="output1">取消</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<button class="but" onclick="save();">提交</button>
					</div>
			</td>
		</tr>
	</tbody>
</table>            
</div>
</div>
</div>	
</body>
</html>
